#include <bits/stdc++.h>
#include <string>
using namespace std;

/* 答案 */
bool res = false;

string substr(string s, int begin)
{
    string r = "";
    for (int i = begin; i < s.length(); i++)
        r += s.at(i);
    return r;
}

/** 比较函数 */
void compare(string s1, string s2)
{
    int s1_len = s1.length(), s2_len = s2.length();
    if (!s1_len || !s2_len)
    {
        res = res || false;
        return;
    }
    char s1_head = s1.at(0), s2_head = s2.at(0);
    if ((s1_len == 1 && s1_head == '*') || (s1_len == 1 && s2_len == 1 && (s1_head == s2_head || s1_head == '?')))
    {
        res = res || true;
        return;
    }
    else if ((s1_head != '?' && s1_head != '*' && s1_head != s2_head) ||
             (s1.find('*') == s1.npos && s1.length() != s2.length()))
    {
        res = res || false;
        return;
    }
    if (s1_head != '*')
        compare(substr(s1, 1), substr(s2, 1));
    else
    {
        for (int i = 0; i <= s2_len; i++)
        {
            compare(substr(s1, 1), substr(s2, i));
        }
    }
}

int main()
{
    string a, b;
    getline(cin, a);
    getline(cin, b);
    compare(a, b);
    if (res)
        cout << "Yes";
    else
        cout << "No";
    return 0;
}
